There are two paths through this chart.
The "windshield wiper" decision is a two-way decision (sometimes called a "binary" decision.) It seems small, but in programs complicated decisions are made of many small decisions. Here is a program (suitable for "copy-paste-and-run") that includes a binary decision.
import java.io.*;
class NumberTester
{
public static void main (String[] args) throws IOException
{
BufferedReader stdin =
new BufferedReader ( new InputStreamReader( System.in ) );
String inData;
int num;
System.out.println("Enter an integer:");
inData = stdin.readLine();
num = Integer.parseInt( inData ); // convert inData to int
if ( num < 0 ) // is num less than zero?
System.out.println("The number " + num + " is negative"); // true-branch
else
System.out.println("The number " + num + " is positive"); // false-branch
System.out.println("Good-bye for now"); // always executed
}
}
The words if and else are markers that divide the
decision into two sections.
The else divides the "true branch" from the
"false branch".
if statment always asks a question (often about a variable.)
Notice that a two-way decision is like picking which of two roads to take
to the same destination.
The fork in the road is the if statement, and the two roads come together
just after the false-branch.